﻿using PuppeteerSharp;
using Q.Spider.Core;
using Q.Spider.Core.Models;
using Q.Spider.Sample.Flow;

//首先运行要下载浏览器文件，
//需要用到代理，如尝试无法下载可尝试手动下载
//https://storage.googleapis.com/chromium-browser-snapshots/Win_x64/1069273/chrome-win.zip
//下载后解压到：程序跟目录/.local-chromium/Win64-1069273/chrome-win
//using var _BrowserFetcher = new BrowserFetcher();
//await _BrowserFetcher.DownloadAsync();



//////淘票票示例，解开注释运行
//两个流处理任务
//TaoPiaoPiao抓取数据
//TaoPiaoPiaoSave保存数据
//var core = new QSpiderCore(new Config()
//{
//    EngineIsHeadless = false,
//    EngineIsLoadImage = false,
//    RequestMaxRetryCount = 3,
//    //Proxy = "http://175.174.182.25:4251",
//    //GetNewProxyAsync = async (core) =>
//    //{
//    //    return 有的时候代理过期，自己处理代理;
//    //}
//});
////淘票票示例
////添加处理流
//core.AddFlow(new TaoPiaoPiao());
//core.AddFlow(new TaoPiaoPiaoSave());
////添加测试请求
//TaoPiaoPiao.AddTestRequest(core);
//core.Start();

////////Midjourney示例，解开注释运行
////演示了自定义LaunchOptions
////获取聊天室的第一张图片
//var core = new QSpiderCore(new Config()
//{
//    EngineIsHeadless = false,
//    EngineIsLoadImage = true,
//    RequestMaxRetryCount = 3,
//}.ConfigureLaunchOptions(null, option =>
//{
//    option.UserDataDir = "d:/userdata/";

//}));
////添加处理流
//core.AddFlow(new Midjourney());
////添加测试请求
//Midjourney.AddTestRequest(core);
//core.Start();



Console.ReadLine();